<template>
    <div>
        <Modal v-model="data.isShow" :mask-closable="false">
            <p slot="header">
                <span>{{data.actionType == 1? '添加': '修改'}}房源</span>
            </p>
            <div style="margin-top: 10px; padding-right: 20px;" >
                <Form ref="form" :model="data.data" :rules="ruleValidate" :label-width="80">
                    <FormItem label="楼座" prop="lou">
                        <Select v-model="data.data.lou" placeholder="请选择楼座"> 
                            <Option :value="0">A座</Option> 
                            <Option :value="1">B座</Option> 
                            <Option :value="2">C座</Option> 
                        </Select>						
					</FormItem>
                    <FormItem label="房间号" prop="num">
                        <Input v-model="data.data.num"  placeholder="请输入房间号"></Input>						
					</FormItem>
                    <FormItem label="朝向" prop="chao">
                        <Input v-model="data.data.chao"  placeholder="请输入朝向"></Input>
                    </FormItem>
                    <FormItem label="面积" prop="mian">
                        <Input v-model="data.data.mian"  placeholder="请输入面积"></Input>
                    </FormItem>
                    <FormItem label="报价" prop="bao">
                        <Input v-model="data.data.bao"  placeholder="请输入报价"></Input>
                    </FormItem>
                </Form>
            </div>
            <div slot="footer">
				<Button 
					type="primary" 
					size="large" 
					:loading="data.isLoading" 
					@click="handleSubmit">
					确认
				</Button>
			</div>
        </Modal> 
    </div>
</template>

<script>
export default {
    props: ['data'],
    data () {
        return {
            ruleValidate: {

            }
        };
    },
    methods: {
        handleSubmit(){
            this.$refs['form'].validate((valid) => {
                if (valid) {
                    this.$emit('on-submit', this.data);
                } else {
                    this.$Message.error('请输入必填项!');
                }
            })
        }
    }
};
</script>

<style lang="less" scoped>

</style>
